/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package KoneksiDB;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

/**
 *
 * @author agung
 */
public class KoneksiAwal {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws SQLException {
        // TODO code application logic here

        //buat tabel
        Connection con;
        con = Koneksi.open();
        Statement stat = con.createStatement();

        String mem1 = "create table TABEL_USER(username varchar2(10) constraint username_id_pk primary key, password varchar2(20), alamat_indomaret varchar2(20))";
        String mem2 = "create table barang(tanggal_masuk date, kode_penerimaan varchar2(10) constraint penerimaan_id_pk primary key, nama_barang varchar2(30), harga number(12), jumlah number(5))";
        String mem3 = "drop table barang";
        String mem4 = "create table pemesanan(tanggal_pesan date, kode_pemesanan varchar2(10), cabang_indomaret varchar2(20), nama_barang varchar2(30), jumlah_barang number(5), status varchar2(20))";

//        stat.executeQuery(mem1);
        stat.executeQuery(mem2);
//        stat.executeQuery(mem3);
//        stat.executeQuery(mem4);
        System.out.println("Query sukses");
    }
}
